home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / HyperCard / ScreenHeight XFCN 1.0.2 / ScreenHeight.c < prev    next >
C/C++ Source or Header  |  1996-07-07  |  2KB  |  70 lines

  1. /* ----------------------------------------------------------------------
  2.  
  3.     ScreenHeight XFCN
  4.     version 1.0.2
  5.     
  6.     Written by: Paul Celestin
  7.     
  8.     Copyright © 1993-1996 Celestin Company, Inc.
  9.     
  10.     This XFCN returns the height of the main screen in pixels.
  11.     
  12.     No parameters required!
  13.     
  14.     930925 - 1.0.0 - initial release
  15.     951215 - 1.0.1 - updated for CW7
  16.     960704 - 1.0.2 - updated for CW9
  17.  
  18. ---------------------------------------------------------------------- */
  19.  
  20. #include <A4Stuff.h>
  21. #include <HyperXCmd.h>
  22.  
  23. #define PARAMETER_NUMS        0
  24. #define PARAMETER_TEXT        "\pNo parameters required!"
  25.  
  26.  
  27. /* ----------------------------------------------------------------------
  28. prototypes
  29. ---------------------------------------------------------------------- */
  30. void DoIt(XCmdPtr paramPtr);
  31. char LookUp[256];
  32.  
  33.  
  34. /* ----------------------------------------------------------------------
  35. main
  36. ---------------------------------------------------------------------- */
  37. pascal void main(XCmdPtr paramPtr)
  38. {
  39.     Str255 copyright = "\pCopyright © 1993-1996 Celestin Company, Inc.";
  40.     long oldA4 = SetCurrentA4();
  41.     if (paramPtr->paramCount != PARAMETER_NUMS)
  42.     {
  43.         paramPtr->returnValue =
  44.             PasToZero(paramPtr,PARAMETER_TEXT);
  45.     }
  46.     else
  47.     {
  48.         DoIt( paramPtr );
  49.     }
  50.     SetA4(oldA4);
  51. }
  52.  
  53. /* ----------------------------------------------------------------------
  54. DoIt
  55. ---------------------------------------------------------------------- */
  56. void DoIt(XCmdPtr paramPtr)
  57. {
  58.     long        height;
  59.     Str255        myString;
  60.     GDHandle    curDev;
  61.     Rect        bounds;
  62.  
  63.     curDev = GetMainDevice();
  64.     bounds = (**curDev).gdRect;
  65.     height = bounds.bottom - bounds.top;
  66.  
  67.     NumToStr(paramPtr,height,myString);
  68.     paramPtr->returnValue = PasToZero(paramPtr,myString);
  69. }
  70.